const {
  mysql
} = require('../qcloud')

module.exports = async (ctx) => {
  const {
    openid,
    pageIndex
  } = ctx.request.query
  const size = 10
 // console.log(openid, pageIndex);
  const order = await mysql('phoneFlowOrder')
    .select('goods_val', 'sell_price', 'order_type', 'tel_number', 'create_time')
    .where('open_id', openid)
    .limit(size)
    .offset(Number(pageIndex) * size)
    .orderBy('create_time', 'desc')
  ctx.state.data = {
    order,
    error_code: 0
  }
}
